package com.yanqu.road.server.cmd.union;

import com.yanqu.road.pb.wingroom.WingRoomProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.player.WorldMessageMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

/**
 * @author ：zfr
 * @date ：2022/3/10 14:55
 */
@Cmd(code = CrossProtocol.C_UNION_CHANGE_CHAT_MESSAGE, desc = "修改商会聊天内容")
public class ChangeUnionChatMessageCmd extends CrossCommand {
    private long sendUserId;
    private int type;
    private String content;
    private long startTime;
    private String unionUid;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        WingRoomProto.ChangeUnionShareMessageStatusMsg msg = WingRoomProto.ChangeUnionShareMessageStatusMsg.parseFrom(packet.getBytes());
        sendUserId = msg.getUserId();
        type = msg.getType();
        content = msg.getContent();
        startTime = msg.getStartTime();
        unionUid = msg.getUnionUid();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        WorldMessageMgr.changeUnionChatMessage(sendUserId, type, content, startTime, unionUid);
    }

    @Override
    public void sendData() {

    }
}
